3.967 \(\int (1-x)^n x^2 (1+x)^{-n} \, dx\)

Optimal. Leaf size=94 \[ -\frac{2^{-n} \left (2 n^2+1\right ) (1-x)^{n+1} \, _2F_1\left (n,n+1;n+2;\frac{1-x}{2}\right )}{3 (n+1)}+\frac{1}{3} n (1-x)^{n+1} (x+1)^{1-n}-\frac{1}{3} x (1-x)^{n+1} (x+1)^{1-n} \]

[Out]

(n*(1 - x)^(1 + n)*(1 + x)^(1 - n))/3 - ((1 - x)^(1 + n)*x*(1 + x)^(1 - n))/3 -
((1 + 2*n^2)*(1 - x)^(1 + n)*Hypergeometric2F1[n, 1 + n, 2 + n, (1 - x)/2])/(3*2
^n*(1 + n))

_______________________________________________________________________________________

Rubi [A]  time = 0.0965805, antiderivative size = 94, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 3, integrand size = 18, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.167 \[ -\frac{2^{-n} \left (2 n^2+1\right ) (1-x)^{n+1} \, _2F_1\left (n,n+1;n+2;\frac{1-x}{2}\right )}{3 (n+1)}+\frac{1}{3} n (1-x)^{n+1} (x+1)^{1-n}-\frac{1}{3} x (1-x)^{n+1} (x+1)^{1-n} \]

Antiderivative was successfully verified.

[In]  Int[((1 - x)^n*x^2)/(1 + x)^n,x]

[Out]

(n*(1 - x)^(1 + n)*(1 + x)^(1 - n))/3 - ((1 - x)^(1 + n)*x*(1 + x)^(1 - n))/3 -
((1 + 2*n^2)*(1 - x)^(1 + n)*Hypergeometric2F1[n, 1 + n, 2 + n, (1 - x)/2])/(3*2
^n*(1 + n))

_______________________________________________________________________________________

Rubi in Sympy [A]  time = 9.55661, size = 68, normalized size = 0.72 \[ \frac{2^{n} \left (2 n^{2} + 1\right ) \left (x + 1\right )^{- n + 1}{{}_{2}F_{1}\left (\begin{matrix} - n, - n + 1 \\ - n + 2 \end{matrix}\middle |{\frac{x}{2} + \frac{1}{2}} \right )}}{3 \left (- n + 1\right )} + \frac{n \left (- x + 1\right )^{n + 1} \left (x + 1\right )^{- n + 1}}{3} - \frac{x \left (- x + 1\right )^{n + 1} \left (x + 1\right )^{- n + 1}}{3} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  rubi_integrate((1-x)**n*x**2/((1+x)**n),x)

[Out]

2**n*(2*n**2 + 1)*(x + 1)**(-n + 1)*hyper((-n, -n + 1), (-n + 2,), x/2 + 1/2)/(3
*(-n + 1)) + n*(-x + 1)**(n + 1)*(x + 1)**(-n + 1)/3 - x*(-x + 1)**(n + 1)*(x +
1)**(-n + 1)/3

_______________________________________________________________________________________

Mathematica [C]  time = 0.147236, size = 79, normalized size = 0.84 \[ \frac{4 x^3 (1-x)^n (x+1)^{-n} F_1(3;-n,n;4;x,-x)}{3 (4 F_1(3;-n,n;4;x,-x)-n x (F_1(4;1-n,n;5;x,-x)+F_1(4;-n,n+1;5;x,-x)))} \]

Warning: Unable to verify antiderivative.

[In]  Integrate[((1 - x)^n*x^2)/(1 + x)^n,x]

[Out]

(4*(1 - x)^n*x^3*AppellF1[3, -n, n, 4, x, -x])/(3*(1 + x)^n*(4*AppellF1[3, -n, n
, 4, x, -x] - n*x*(AppellF1[4, 1 - n, n, 5, x, -x] + AppellF1[4, -n, 1 + n, 5, x
, -x])))

_______________________________________________________________________________________

Maple [F]  time = 0.079, size = 0, normalized size = 0. \[ \int{\frac{ \left ( 1-x \right ) ^{n}{x}^{2}}{ \left ( 1+x \right ) ^{n}}}\, dx \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  int((1-x)^n*x^2/((1+x)^n),x)

[Out]

int((1-x)^n*x^2/((1+x)^n),x)

_______________________________________________________________________________________

Maxima [F]  time = 0., size = 0, normalized size = 0. \[ \int{\left (x + 1\right )}^{-n} x^{2}{\left (-x + 1\right )}^{n}\,{d x} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  integrate(x^2*(-x + 1)^n/(x + 1)^n,x, algorithm="maxima")

[Out]

integrate((x + 1)^(-n)*x^2*(-x + 1)^n, x)

_______________________________________________________________________________________

Fricas [F]  time = 0., size = 0, normalized size = 0. \[{\rm integral}\left (\frac{x^{2}{\left (-x + 1\right )}^{n}}{{\left (x + 1\right )}^{n}}, x\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  integrate(x^2*(-x + 1)^n/(x + 1)^n,x, algorithm="fricas")

[Out]

integral(x^2*(-x + 1)^n/(x + 1)^n, x)

_______________________________________________________________________________________

Sympy [F(-1)]  time = 0., size = 0, normalized size = 0. \[ \text{Timed out} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  integrate((1-x)**n*x**2/((1+x)**n),x)

[Out]

Timed out

_______________________________________________________________________________________

GIAC/XCAS [F]  time = 0., size = 0, normalized size = 0. \[ \int \frac{x^{2}{\left (-x + 1\right )}^{n}}{{\left (x + 1\right )}^{n}}\,{d x} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  integrate(x^2*(-x + 1)^n/(x + 1)^n,x, algorithm="giac")

[Out]

integrate(x^2*(-x + 1)^n/(x + 1)^n, x)